package com.iwomy.secureplat.platform.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iwomy.secureplat.platform.entity.*;
import com.iwomy.secureplat.platform.mapper.BasicVideoProviderTypeMapper;
import com.iwomy.secureplat.platform.service.BasicVideoProviderTypeService;
import org.springframework.stereotype.Service;
import java.util.*;

/**
 * 视频类设备服务商类型表
 *
 * @author pig
 * @date 2024-02-18 15:21:34
 */
@Service
public class BasicVideoProviderTypeServiceImpl extends ServiceImpl<BasicVideoProviderTypeMapper, BasicVideoProviderTypeEntity> implements BasicVideoProviderTypeService {

	@Override
	public Page getVideoProviderTypePage(Page page, BasicVideoProviderTypeEntity basicVideoProviderType) {
		LambdaQueryWrapper<BasicVideoProviderTypeEntity> wrapper = Wrappers.lambdaQuery();

		if (StrUtil.isNotEmpty(basicVideoProviderType.getProviderName())) {
			wrapper.like(BasicVideoProviderTypeEntity::getProviderName, basicVideoProviderType.getProviderName());
		}

		return baseMapper.selectPage(page, wrapper);
	}

	@Override
	public List<BasicVideoProviderTypeEntity> getVideoProviderTypeList(BasicVideoProviderTypeEntity basicVideoProviderTypeEntity) {
		LambdaQueryWrapper<BasicVideoProviderTypeEntity> wrapper = Wrappers.lambdaQuery(basicVideoProviderTypeEntity);
		wrapper.eq(BasicVideoProviderTypeEntity::getState,10);
		return this.baseMapper.selectList(wrapper);
	}

}